package servicesImp.company;

import base.IBaseMapperWithoutBLOBs;
import base.IBaseServicesWithoutBLOBsImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import services.company.CompanyInfoServices;
import services.upms.PermissionRoleServices;
import wt.dao.company.CompanyInfoMapper;
import wt.entity.company.CompanyInfo;
import wt.entity.company.CompanyInfoExample;
import wt.staticData.TableName;

import java.util.List;

/**
 * Created by Administrator on 2017/12/11.
 */
@Service
public class CompanyInfoInfoServicesImp extends IBaseServicesWithoutBLOBsImpl<CompanyInfo,CompanyInfoExample> implements CompanyInfoServices {
    @Autowired
    CompanyInfoMapper companyInfoMapper;
    @Autowired
    PermissionRoleServices permissionRoleServices;

    @Override
    public IBaseMapperWithoutBLOBs<CompanyInfo, CompanyInfoExample> getMapper() {
        return companyInfoMapper;
    }

    @Override
    public String getTableName() {
        return TableName.CMS_COMPANY_INFO;
    }

    public CompanyInfo selectByCompanyCode(String companyCode) throws Exception {
        CompanyInfoExample companyInfoExample=new CompanyInfoExample();
        companyInfoExample.createCriteria().andCompanyCodeEqualTo(companyCode);
        List<CompanyInfo> companyInfoList = selectByExample(companyInfoExample);
        if (companyInfoList.isEmpty()){
            return null;
        }else{
            return  companyInfoList.get(0);
        }
    }


}
